<?php
$dis_id=3;
include("../../inc/conn.inc");
include("../islogin2.php");
    if($per_row["m_type"]=="3")
    {
        checkCount("jm_list");
    }
$check_rs=@mysql_query("select id,m_type,m_jifen from member where id='".$_COOKIE['user_id']."'");
$check_row=@mysql_fetch_array($check_rs);

if($_POST[act_tj]){
	    $_POST["j_title"]=delwords($_POST["j_title"]);
    $_POST["info"]=delwords($_POST["info"]);
    $_POST["pinpai"]=delwords($_POST["pinpai"]);

   $n_rs2=@mysql_query("select count(id) from jm_list where member_id='".$_COOKIE['user_id']."'");
   $num=@mysql_result($n_rs2,0);
   @mysql_free_result($n_rs2);
   	    $c_rs_1=mysql_query("select * from jm_catalog where id='$_POST[catalog_1]'");
	    $c_row_1=mysql_fetch_array($c_rs_1);
	    $c_rs_2=mysql_query("select * from jm_catalog where id='$_POST[catalog_2]'");
	    $c_row_2=mysql_fetch_array($c_rs_2);
	    $catalog_1=($_POST[catalog_1])?$_POST[catalog_1]:0;
	    $catalog_2=($_POST[catalog_2])?$_POST[catalog_2]:0;
if($check_row[m_type]==3){
	  if($num>=10){  
	    echo "<script>alert('您只能发布10条加盟信息。');location='index.php';</script>";
	  }else{

	    @mysql_query("insert into jm_list (member_id,j_title,type_id1,type_name1,type_id2,type_name2,j_info,picture,j_pinpai,j_price,j_bzj,j_ztze,j_ppfyd,j_ppls,j_qdl,j_fhqx,j_scjhje,j_ghzl,j_fzms,j_hzfs,j_ghzk,j_khhbl,j_lsjgdw,j_mbxfqt,j_yjhbl,j_yjhbzq,j_txqsyf,j_htqx,j_jmszs,j_txjysj,addtime) values ('".$_COOKIE['user_id']."','$_POST[j_title]','$catalog_1','$c_row_1[cat_name]','$catalog_2','$c_row_2[cat_name]','$_POST[info]','$_POST[picture]','$_POST[pinpai]','$_POST[price]','$_POST[bzj]','$_POST[ztze]','$_POST[ppfyd]','$_POST[ppls]','$_POST[qdl]','$_POST[fhqx]','$_POST[scjhje]','$_POST[ghzl]','$_POST[fzms]','$_POST[hzfs]','$_POST[ghzk]','$_POST[khhbl]','$_POST[lsjgdw]','$_POST[mbxfqt]','$_POST[yjhbl]','$_POST[yjhbzq]','$_POST[txqsyf]','$_POST[htqx]','$_POST[jmszs]','$_POST[txjysj]','".date("Y-m-d H:i:s")."')");
	    echo "<script>alert('发布成功,继续发布');location='add.php';</script>";
	  }
}else{

	    @mysql_query("insert into jm_list (member_id,j_title,type_id1,type_name1,type_id2,type_name2,j_info,picture,j_pinpai,j_price,j_bzj,j_ztze,j_ppfyd,j_ppls,j_qdl,j_fhqx,j_scjhje,j_ghzl,j_fzms,j_hzfs,j_ghzk,j_khhbl,j_lsjgdw,j_mbxfqt,j_yjhbl,j_yjhbzq,j_txqsyf,j_htqx,j_jmszs,j_txjysj,addtime) values ('".$_COOKIE['user_id']."','$_POST[j_title]','$catalog_1','$c_row_1[cat_name]','$catalog_2','$c_row_2[cat_name]','$_POST[info]','$_POST[picture]','$_POST[pinpai]','$_POST[price]','$_POST[bzj]','$_POST[ztze]','$_POST[ppfyd]','$_POST[ppls]','$_POST[qdl]','$_POST[fhqx]','$_POST[scjhje]','$_POST[ghzl]','$_POST[fzms]','$_POST[hzfs]','$_POST[ghzk]','$_POST[khhbl]','$_POST[lsjgdw]','$_POST[mbxfqt]','$_POST[yjhbl]','$_POST[yjhbzq]','$_POST[txqsyf]','$_POST[htqx]','$_POST[jmszs]','$_POST[txjysj]','".date("Y-m-d H:i:s")."')");
       $product_id=@mysql_result(@mysql_query("select last_insert_id() from jm_list where member_id='".$_COOKIE['user_id']."'"),0); 
       echo "<script>alert('钻石会员对该信息可以发10张宣传图片');location='img.php?id=$product_id';</script>";
}  
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>会员中心-三帝贸易网</title>
<link href="../css/css.css" rel="stylesheet" type="text/css" />
</head>
<script type="text/javascript" src="../js/left.js" charset="gb2312"></script>
<body>
<script language = "JavaScript">    
<?php
$rs1=mysql_query("select * from jm_catalog order by id asc");
?>
var onecount;
onecount=0;
subcat=new Array();
<?php
$count1=0;
while($row1=mysql_fetch_array($rs1)){?>
subcat[<?=$count1?>]=new Array("<?=$row1[cat_name]?>","<?=$row1[cat_id]?>","<?=$row1[id]?>");
<?php
$count1=$count1+1;}?>
onecount=<?=$count1?>;  
//联动函数    
function changelocation(locationid){   
   document.form1.catalog_2.length=0;     
   var locationid=locationid;   
   var i;   
   for(i=0;i<onecount;i++){   
       if(i==0){     
          document.form1.catalog_2.options[document.form1.catalog_2.length]=new Option("--二级分类--","");
		  }   
       if(subcat[i][1]==locationid){     
          document.form1.catalog_2.options[document.form1.catalog_2.length]=new Option(subcat[i][0],subcat[i][2]);   
          }                   
    }   
}
</script>
<div id="mian">
<?php include("../inc/top.php");?>
<div class="top1"><span>您当前位置：<a href="../index.php" class="dh">会员助手</a> &gt;&gt; 代理加盟 &gt;&gt; 发布代理加盟</span></div>
<div class="left">
<?php include("../inc/left.php");?>
</div>
<div class="right">
<TABLE cellSpacing="0" cellPadding="0" width="100%" border="0">
   <TR>
     <TD height="40" bgcolor="#EFF6FF" style="font-size:18px;font-weight:bold;padding-left:8px;">发布代理加盟信息</TD>
   </TR>
</TABLE>
<br>
<TABLE width="100%" border="0" cellpadding="0" cellSpacing="1" bgcolor="#C1DCF5">
        <TBODY>
        <form method="post" action="" name="form1" onSubmit="return checkform()">
          <TR>
            <td width="17%" height="25" align="center" bgcolor="#EFF6FF">代理加盟标题&nbsp;<font color="#FF0000">*</font></td>
            <TD width="83%" bgcolor="#F9F9F9" style="padding-left:4px;"><input name="j_title" id="j_title" type="text" size="50" maxlength="120"></TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">代理加盟目录<span style="padding-left:4px;line-height:35px;">&nbsp;<font color="#FF0000">*</font></span></td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;line-height:35px;">

<select name="catalog_1" id="catalog_1" onChange="changelocation(document.form1.catalog_1.options[document.form1.catalog_1.selectedIndex].value)">
 <option value="">--选择大类--</option>   
<?php
$rrs=mysql_query("select id,cat_name from jm_catalog where cat_id=0 order by id asc");    
while($rrow=mysql_fetch_array($rrs)){   
?>     
 <option value="<?=$rrow[id]?>"><?=$rrow[cat_name]?></option><?php }?>
</select>&nbsp;<select name="catalog_2" id="catalog_2" onFocus="changelocation(document.form1.catalog_1.options[document.form1.catalog_1.selectedIndex].value)">
  <option value="">--选择二级分类--</option>
</select></TD>
          </TR>		  
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">描述&nbsp;<font color="#FF0000">*</font></td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><textarea name="info" id="info" cols="70" rows="20"></textarea>
            <br>
            <font color="#FF0000">警告：</font>请不要添加<font color="#FF0000">公司电话</font>和贵<font color="#FF0000">公司网址</font>，否则我们直接删除该信息。<br></TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">图片</td>
            <TD bgcolor="#F9F9F9" style="padding:4px;line-height:30px;"><input name="picture" id="picture" type="text" size="35" maxlength="100">&nbsp;&nbsp;<input name="button" type="button" onClick="window.open ('../upfile.php', 'newwindow', 'height=50, width=400, top=250, left=250, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no')" value="上传图片">
              (建议图片长宽：270*240)<br>
              <input type="button" onClick="window.open ('/member/photo/info.php', 'newwindow', 'height=500, width=600, top=0, left=250, toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=no, status=no')" value="选择已上传的图片"></TD>
          </TR>
		  <TR>
            <td height="25" colspan="2" align="left" bgcolor="#EFF6FF"><STRONG>参数<font color="#FF0000">(请认真完善以下资料，否则您的信息将直接删除)</font></STRONG></td>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">产品品牌</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="pinpai" id="pinpai" type="text" size="20" maxlength="10"></TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">加盟费</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;">
			<select name="price" id="price">
             <option value="">--选择金额--</option>
		     <option value="免费">免费</option>
		     <option value="0-1万">0-1万</option>
		     <option value="1-5万">1-5万</option>
		     <option value="5-10万">5-10万</option>
		     <option value="10-25万">10-25万</option>
		     <option value="25-40万">25-40万</option>
		     <option value="50万以上">50万以上</option>
        </select></TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">保证金额</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="bzj" id="bzj" type="text" size="10" maxlength="5">
            万元</TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">总投资额</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="ztze" id="ztze" type="text" size="10" maxlength="6">
            万元</TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">品牌发源地</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="ppfyd" id="ppfyd" type="text" size="20" maxlength="10"></TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">品牌历史</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="ppls" id="ppls" type="text" size="10" maxlength="3">
            年</TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">起 订 量</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="qdl" id="qdl" type="text" size="20" maxlength="20"></TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">发货期限</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="fhqx" id="fhqx" type="text" size="20" maxlength="10"></TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">首次进货金额</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="scjhje" id="scjhje" type="text" size="10" maxlength="5">
            万元</TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">供货总量</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="ghzl" id="ghzl" type="text" size="10" maxlength="8"></TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">发展模式</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="fzms" id="fzms" type="text" size="20" maxlength="20"></TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">合作方式</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="hzfs" id="hzfs" type="text" size="20" maxlength="20"></TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">供货折扣</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="ghzk" id="ghzk"  type="text" size="10" maxlength="6">
            折</TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">可换货比率</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="khhbl" id="khhbl" type="text"  size="10" maxlength="10"></TD>
          </TR>
		  
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">零售价格定位</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="lsjgdw" id="lsjgdw"  type="text" size="10" maxlength="8">
            元</TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">目标消费群体</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="mbxfqt" id="mbxfqt"  type="text" size="15" maxlength="8">
            年龄段</TD>
          </TR>		  		  
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">预计回报率</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="yjhbl" id="yjhbl"  type="text" size="20" maxlength="20"></TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">预计回报周期</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="yjhbzq" id="yjhbzq"  type="text" size="20" maxlength="10"></TD>
          </TR>			  
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">特许权使用费</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="txqsyf" id="txqsyf"  type="text" size="20" maxlength="8"></TD>
          </TR>
		  
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">合同期限</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="htqx" id="htqx"  type="text" size="10" maxlength="5"></TD>
          </TR>	
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">加盟商总数</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="jmszs" id="jmszs"  type="text" size="10" maxlength="6"></TD>
          </TR>	
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">特许经营时间</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="txjysj" id="txjysj"  type="text" size="10" maxlength="5"></TD>
          </TR>			  		  		  
		  
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">&nbsp;</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input type="submit" value="提交">
        <INPUT type="hidden" value="ok" name="act_tj"></TD>
          </TR>
 </form>                
</TABLE>
</div>
<div class="onl"></div>
<?php include("../inc/foot.php");?>

</div>
</body>
</html>
<script language="javascript">
function $(id){
return document.getElementById(id);
}
function checkform(){
   if($("j_title").value==""){
      alert("标题不能为空");
      $("j_title").focus();
      return false;
   }
   if($("catalog_1").value==""){
      alert("请选择目录");
      $("catalog_1").focus();
      return false;
   }
   if($("catalog_2").value==""){
      alert("请选择二级目录");
      $("catalog_2").focus();
      return false;
   }

   if($("info").value==""){
      alert("描述不能为空");
      $("info").focus();
      return false;
   }   
}
</script>
